//
//  SettingVC.swift
//  ProjectApp
//
//  Created by jack on 2021/1/5.
//

import UIKit

class SettingVC: BaseVC {
    @IBOutlet weak var swithchBtn: UIButton!
    @IBAction func changLangBtnClick(_ sender: Any) {
        let cnModel = AlertModel(title: "简体中文") {
            setUserlanguageType(languageType: .ZhHans)
        }
        let enModel = AlertModel(title: "English") {
            setUserlanguageType(languageType: .En)
        }
        showActionSheet(title: "mine_change_language".localizedString(table: nil), message: nil, modelArray: [cnModel, enModel], cancelTitle: "common_cancel".localizedString(table: nil), cancelHandle: {
            
        }, vc: self, sourceView: sender as? UIView)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
       let _ = NotificationCenter.default.rx.notification(CPLANGUAGE_CHANGE_NOTIFICATION).subscribe { (not) in
            self.refreshUI()
        }
        refreshUI()
    }


    func refreshUI() {
        self.swithchBtn.setTitle("mine_change_language".localizedString(table: nil), for: UIControl.State.normal)
    }


    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
